package com.clougence.cloudcanal.dataprocess.datatransform.model;

import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * @author yongSen.wang
 * @date 2022/03/13 16:34
 */
@Data
public class GlanceRecordParam implements Serializable {

    private static final long serialVersionUID = -8744597796155072658L;

    /**版本.*/
    private String            version;
    /**屏幕.*/
    private String            screen;
    /**客户端ID，由客户端生成，存储在localeStorage中的浏览器ID.*/
    @JSONField(name = "client_id")
    private String            clientId;
    /**设备id，基于fingerprintjs生成的设备ID.*/
    @JSONField(name = "device_id")
    private String            deviceId;
    /**存储在sessionStorage中的会话ID.*/
    @JSONField(name = "session_id")
    private String            sessionId;
    /**联盟ID.*/
    @JSONField(name = "union_id")
    private String            unionId;
    /**用户编号.*/
    @JSONField(name = "user_id")
    private String            userId;
    /**utm.*/
    private String            utm;
    /**时区偏移量（分钟）.*/
    private String            timezone;
    /**浏览器客户代理 navigator.userAgent.*/
    @JSONField(name = "user_agent")
    private String            userAgent;
    /**浏览器语言 navigator.language.*/
    private String            language;
    /**网络类型 navigator.connection.*/
    private String            network;
    /**cpu.*/
    private String            cpu;
    /**页面标题.*/
    private String            title;
    /**事件名称.*/
    private String            event;
    /**网页地址.*/
    private String            url;
    /**浏览器当前时间.*/
    private Date              time;
    /**网页来源 document.referrer.*/
    private String            referrer;
    /**utm数据.*/
    @JSONField(name = "utm_data")
    private String            utmData;
    /**事件参数.*/
    @JSONField(name = "event_data")
    private EventData         eventData;
    /**国家.*/
    private String            country;
    /**goboo选项语言，页面展示语言.*/
    @JSONField(name = "gb_lang")
    private String            gbLang;
    /**环境.*/
    private String            env;
    /**平台类型 1:pc 2:wap 3:android 4:ios.*/
    private String            platform;

    @Data
    public static class EventData {
        @JSONField(name = "order_id")
        private String          orderId;
        @JSONField(name = "pay_number")
        private String          payNumber;
        private List<GoodsItem> items;
    }

    @Data
    public static class GoodsItem {
        @JSONField(name = "sku_id")
        private Integer    skuId;
        @JSONField(name = "spu_id")
        private Integer    spuId;
        @JSONField(name = "item_name")
        private String     itemName;
        private BigDecimal value;
        private Integer    quantity;
        @JSONField(name = "shipping_fee")
        private BigDecimal shippingFee;
    }

}
